package com.quectel.core.module.forum.entity.mongo;

import com.quectel.core.constants.MongoCollectionConstants;
import com.quectel.util.client.mongo.MongoBaseModel;
import lombok.Data;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.MongoId;

import java.util.Date;

/**
 * @author zhangheng
 * @email nolan.zhang@quectel.com
 * @date 2023/5/8 15:52
 * @description 评论
 */
@Data
@Document(MongoCollectionConstants.FORUM_COMMENT)
@CompoundIndex(name = "idx_id_comment_time", def = "{'id': 1,'commentTime': 1}", background = true)
public class ForumCommentModel implements MongoBaseModel {
    /**
     * id
     */
    @MongoId
    private Long id;

    /**
     * 帖子Id
     */
    @Indexed(name = "idx_tenant_post", background = true)
    private Long forumPostId;


    /**
     * 父级评论Id 默认为-1
     */
    private Long parentId = -1L;

    /**
     * 评论人id
     */
    private Long personId;

    /**
     * 住户id
     */
    private Long householdId;

    /**
     * 被评论人id
     */
    private Long commentedPersonId;

    /**
     * 内容
     */
    private String content;

    /**
     * 点赞数量
     */
    private Integer likeCount = 0;

    /**
     * 评论数量
     */
    private Integer commentCount = 0;

    /**
     * 删除标识
     */
    @Indexed(name = "idx_delete", background = true)
    private Byte deletedFlag = 0;

    /**
     * 创建时间
     */
    private Date commentTime;

    /**
     * 更新时间
     */
    private Date updateTime;


}
